#!/usr/bin/env python

import csv
import operator

file1 = "AUC.out"

f1 = csv.reader(open(file1), delimiter = '\t')

ok = dict()
for row in f1:
    dist = row[0]   
    c1 = row[1]
    c2 = row[2]
    blosum = row[3]
    db = row[4]
    score = float(row[5])
    k = (dist, c1, c2, blosum)
    
    if ok.has_key(k):
        ok[k].append(score)
    else:
        ok[k] = [score]

score_max = [0,0,0,0,0]
para_max = []

average_score = dict()

for kk in ok:
    ss = sum(ok[kk])/10.0
    average_score[kk] = ss
    

sorted_dict = sorted(average_score.iteritems(), key=operator.itemgetter(1))

for i in sorted_dict:
    print "parameters:", i[0][0], i[0][1], i[0][2], i[0][3], "| Average AUC:", i[1]
